package com.yy.personalcv.service.impl;

import com.yy.personalcv.mapper.InternshipMapper;
import com.yy.personalcv.pojo.Internship;
import com.yy.personalcv.pojo.Skill;
import com.yy.personalcv.service.InternshipService;
import org.springframework.stereotype.Service;

import javax.annotation.Resource;
import java.util.Date;
import java.util.List;
import java.util.Map;

@Service
public class InternshipServiceImpl implements InternshipService {

    @Resource
    private InternshipMapper internshipMapper;

    @Override
    public void addInternship(Internship internship) {
        internship.setModified(new Date());
        internship.setDisplay(1);
        internshipMapper.addInternship(internship);
    }

    @Override
    public List<Internship> selectTen(Map map) {
        return internshipMapper.selectTen(map);
    }

    @Override
    public int getInternshipCounts(int uid) {
        return internshipMapper.getInternshipCounts(uid);
    }

    @Override
    public Internship getInternshipDetail(int id, int uid) {
        return internshipMapper.getInternshipDetail(id, uid);
    }

    @Override
    public void deleteInternship(int id, int uid) {
        internshipMapper.deleteInternship(id, uid);
    }

    @Override
    public List<Internship> selectAll(int uid) {
        return internshipMapper.selectAll(uid);
    }

    @Override
    public void updateInternship(Internship internship) {
        internship.setModified(new Date());
        internshipMapper.updateInternship(internship);
    }
}
